package io.sk.controller;


import io.sk.common.base.BaseController;
import io.sk.common.base.BaseResult;
import io.sk.entity.ClassEntity;
import io.sk.service.ClassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 班级信息
 *
 * @author xubinren
 * @version 1.0
 * @date 2018/5/8 18:04
 */
@RestController
@RequestMapping("class")
@Api(tags = "幼儿园接口")
public class ClassController extends BaseController {

    @Autowired
    private ClassService classService;

    /**
     * 创建班级
     *
     * @param classEn 班级信息
     * @return BaseResult
     */
    @PostMapping("/save")
    @ApiOperation("创建")
    public BaseResult save(ClassEntity classEn) {

        return classService.save(classEn);
    }

    /**
     * 班级下拉列表查询
     *
     * @param searchValue 查询条件：班级群号、名称（幼儿园名称+班级名称）、老师名称
     * @return BaseResult
     */
    @PostMapping("/selectList")
    @ApiOperation("班级下拉列表查询")
    public BaseResult selectList(String searchValue) {

        return classService.selectList(searchValue);
    }

    /**
     * 相册管理——班级列表查询
     *
     * @param id 教师id
     * @return BaseResult
     */
    @PostMapping("/albumClassList")
    @ApiOperation("相册管理——班级列表查询")
    public BaseResult albumClassList(@RequestParam(value = "id") String id) {

        return classService.albumClassList(id.trim());
    }

}
